package test5.lupeng.jf.com.teamdemo.untils;

import okhttp3.MediaType;
import okhttp3.Request;


/**
 * 网络访问工具类
 * Created by veuiuv on 2017/7/26.
 */


public class RequestUtils {

    // 头部
    private static final String HEADER_X_LC_ID = "X-LC-Id";
    private static final String HEADER_X_LC_KEY = "X-LC-Key";
    private static final String HEADER_CONTENT_TYPE = "Content-Type";
    // 请求头的值
    private static final String X_LC_ID_VALUE = "S5KdTtqGDUwpImMvQ6HAJYaL-gzGzoHsz";
    private static final String X_LC_KEY_VALUE = "NRPgCGiGxjbtGN2Bn0mlglrL";
    private static final String CONTENT_TYPE_JSON = "application/json";

    // 上传Json 类型
    public static final MediaType JSONTYPE = MediaType.parse("application/json; charset=utf-8");

    /**
     *  获取带有请求头的Builder
     * @return
     */
    public static Request.Builder getBuilder() {
        Request.Builder builder = new Request.Builder()
                .addHeader(HEADER_X_LC_ID, X_LC_ID_VALUE)//
                .addHeader(HEADER_X_LC_KEY, X_LC_KEY_VALUE)//
                .addHeader(HEADER_CONTENT_TYPE, CONTENT_TYPE_JSON);;
        return builder;
    }

}
